<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');
/*
 * 记账相关
 * 
 */

class Accounts extends CI_Controller {

	/**
	 * 记账页面
	 * freestyle
	 */
	public function index() {
		$this->freestyle();
	}
	
	
	public function freeStyle(){
		$this->load->view('keep_account_free_style');
	}
	
	/**
	 * 记账语句分析输入生成表格
	 */
	public function inputAnalysis(){
		
		
	}

	public function tableStyle() {
		
		$this->load->view('keep_account_table_style');
	}
	
	//
	public function testDateParseJson(){
//		$this->load->library('ParseDateFromChinese');
		
		include APPPATH.'libraries/parseDateFromChinese.php';
		
		$string = isset ($_POST['str'])?$_POST['str']:'';
		$strings = explode("\n", $string);
		//print_r($strings);
		$dates = array();
		foreach($strings as $str){
			$xx = new ParseDateFromChinese();
			$xx->parseAll($str);
			if(!empty ($xx->dates)){
				foreach($xx->dates as $date){
					$dates[] = $date;
				}
			}
		}
		
		echo json_encode($dates);
	}
	
	public function testDateParse(){
		$this->load->view('test_parse_date');
	}
}
